package cn.yangliu.task.enums;

import java.util.Arrays;

public enum TaskStatusEnum {

    STOP(0, "暂停"),
    ACTIVE(1, "启动");

    private int status;
    private String desp;

    TaskStatusEnum(int status, String desp) {
        this.status = status;
        this.desp = desp;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getDesp() {
        return desp;
    }

    public void setDesp(String desp) {
        this.desp = desp;
    }

    public static String getDespByStatus(int status) {
        TaskStatusEnum[] enums = values();
        return Arrays.stream(enums).filter(e -> e.status == status).findFirst().get().desp;
    }
}
